<!DOCTYPE html>
<html class="x-admin-sm" lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>确认服务商页面</title>
    <link rel="stylesheet" th:href="@{/css/shopstyle.css}">
    <header th:replace="header::html"></header>
</head>
<body>

<h2 style="text-align: center;margin-top:50px;">已投标的服务商或者联盟</h2>
<input type="hidden" id="nid" th:value="${nid}">
<div id="div3">
    <table border="1" cellpadding="10" cellspacing="10" >
        <tr id="tr1">

        </tr>
        <tr id="tr2">

        </tr>


    </table>

</div>
</body>
<script>
	window.onload = function () {
		var nid1 = document.getElementById("nid").value;
		$.ajax({
			type: 'GET',
			url: '/api-front/frontneed/SpecifiedUserList',
			data: {'nid': nid1},
			success: function (result) {


					for (var i = 0; i <result.userList.length ; i++) {



						$('#tr1').append('<td><div id="a1"></div><span >服务商名称：' +result.userList[i].uname+' </span><input type="button" value="查看详情" onclick="aClick(this)" title="' +result.userList[i].uid+'"><input type="button" value="确认" onclick="aClick1(this)" title="' +result.userList[i].tips1+'"></td>');

					}

					for (var j = 0; j <result.alliances.length ; j++) {



						$('#tr1').append('<td><div id="a1"></div><span >联盟名称：' +result.alliances[j].aname+' </span><input type="button" value="查看详情" onclick="aClick2(this)" title="' +result.alliances[j].aid+'" ><input type="button" value="确认" onclick="aClick1(this)" title="' +result.alliances[j].tips1+'"></td>');

					}

                }



		});
	};

	function aClick(node) {
		var path = node.title;
		// alert(path);
		xadmin.open('服务商信息页面', '/api-front/frontneed/getServiceInfo/?uid=' +path);

	}

	function aClick2(node) {
		var path = node.title;
		// alert(path);
		xadmin.open('联盟信息页面', '/api-front/frontneed/getUnionInfo/?uid=' +path);
	}


	function aClick1(node) {
		var path = node.title;
		var nid1 = document.getElementById("nid").value;
		$.ajax({
			url: "/api-front/frontneed/confirmServiceProvider",
			type: "GET",
			data: {nid: nid1,tid:path},
			dataType: 'text',
			success: function (msg) {

				if (msg==="yes"){
					layer.alert("确认成功.....", {icon: 1});

                    xadmin.close();
					// 可以对父窗口进行刷新
					xadmin.father_reload();

                } else{
					alert("确认服务商失败");
                }
			},
		});



	}



</script>





</html>